﻿/*----------------------------------------------------------------
//  <copyright file="IJwtBearerService.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2022-12-23 11:29</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Identity.JwtBearer
{
    #region "定义JwtBearer服务，负责JwtToken的创建，验证，刷新等业务"
    /// <summary>
    /// 定义JwtBearer服务，负责JwtToken的创建，验证，刷新等业务
    /// </summary>
    public interface IJwtBearerService
    {
        #region "方法"
        #region "创建指定用户的JwtToken信息"
        /// <summary>
        /// 创建指定用户的JwtToken信息
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="organizationId">组织机构编号</param>
        /// <param name="clientId">客户端ID</param>
        /// <param name="clientType">客户端类型</param>
        /// <returns>JwtToken信息</returns>
        Task<JsonWebToken> CreateToken(string userId, string organizationId, string clientId, RequestClientType clientType = RequestClientType.Browser);
        #endregion
        #region "使用RefreshToken获取新的JwtToken信息"
        /// <summary>
        /// 使用RefreshToken获取新的JwtToken信息
        /// </summary>
        /// <param name="refreshToken">刷新Token字符串</param>
        /// <returns>JwtToken信息</returns>
        Task<JsonWebToken> RefreshToken(string refreshToken);
        #endregion

        #region "移除订阅者Token缓存"
        /// <summary>
        /// 移除订阅者Token缓存
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="clientId">客户端ID</param>
        /// <returns>JwtToken信息</returns>
        Task RemoveAudienceCache(string userId, string clientId);
        #endregion

        #endregion

    }
    #endregion

}
